package com.stock.model;

import java.util.Date;

import org.apache.commons.lang3.builder.ToStringBuilder;

import yahoofinance.histquotes.HistoricalQuote;
import yahoofinance.quotes.stock.StockQuote;

public class StockVO {
	private int id;
	private Date trade_date;
	private String symbol;
	private double open;
	private double high;
	private double low;
	private double price;
	private long volume;
	
	private double lowPoint1 ;
	private double lowPoint2 ;
	private double highPoint1;
	private double highPoint2;  
	private double hisHighPoint;
	private StockStatus stockStatus;
	private String checkPoint="false";
	private String note;
	private String tagName;
	private String tagDesc;
	
	
	/**
	 * 0: 沒有訊號   
	 * 1： 買進訊號
	 * 2 ：加碼訊號
	 * 3： 賣出訊號
	 * 4： 停損訊號 
	 */
	private int signalStatus;
	 
	public StockVO() {
		
	}
	
	public StockVO(StockQuote stockQuote) {
		 this.setTrade_date(stockQuote.getLastTradeTime().getTime());
		 this.setSymbol(stockQuote.getSymbol());
		 this.setSymbol(stockQuote.getSymbol());
		 this.setOpen(stockQuote.getOpen().doubleValue());
		 this.setHigh(stockQuote.getDayHigh().doubleValue());
		 this.setLow(stockQuote.getDayLow().doubleValue());
		 this.setPrice(stockQuote.getPrice().doubleValue());
		 this.setVolume(stockQuote.getVolume());
	} 

	
	public StockVO(HistoricalQuote hisStockQuote) {
		 this.setTrade_date(hisStockQuote.getDate().getTime());
		 this.setSymbol(hisStockQuote.getSymbol());
		 this.setSymbol(hisStockQuote.getSymbol());
		 this.setOpen(hisStockQuote.getOpen().doubleValue());
		 this.setHigh(hisStockQuote.getHigh().doubleValue());
		 this.setLow(hisStockQuote.getLow().doubleValue());
		 this.setPrice(hisStockQuote.getClose().doubleValue());
		 this.setVolume(hisStockQuote.getVolume());
	} 

	
	 
	public String getTagName() {
		return tagName;
	}
	
	public void setTagName(String tagName) {
		this.tagName = tagName;
	}
	 
	public String getTagDesc() {
		return tagDesc;
	}

	public void setTagDesc(String tagDesc) {
		this.tagDesc = tagDesc;
	}

	public int getSignalStatus() {
		return signalStatus;
	}

	public void setSignalStatus(int signalStatus) {
		this.signalStatus = signalStatus;
	}

	public String getCheckPoint() {
		return checkPoint;
	}

	public void setCheckPoint(String checkPoint) {
		this.checkPoint = checkPoint;
	}

	public String getNote() {
		return note;
	}
	public void setNote(String note) {
		this.note = note;
	}
	public double getLowPoint1() {
		return lowPoint1;
	}
	public void setLowPoint1(double lowPoint1) {
		this.lowPoint1 = lowPoint1;
	}
	public double getLowPoint2() {
		return lowPoint2;
	}
	public void setLowPoint2(double lowPoint2) {
		this.lowPoint2 = lowPoint2;
	}
	public double getHighPoint1() {
		return highPoint1;
	}
	public void setHighPoint1(double highPoint1) {
		this.highPoint1 = highPoint1;
	}
	public double getHighPoint2() {
		return highPoint2;
	}
	public void setHighPoint2(double highPoint2) {
		this.highPoint2 = highPoint2;
	}
	public double getHisHighPoint() {
		return hisHighPoint;
	}
	public void setHisHighPoint(double hisHighPoint) {
		this.hisHighPoint = hisHighPoint;
	}
	
	
	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}
	 
	 
	public String getSymbol() {
		return symbol;
	}
	public void setSymbol(String symbol) {
		this.symbol = symbol;
	}
	public double getOpen() {
		return open;
	}
	public void setOpen(double open) {
		this.open = open;
	}
	public double getHigh() {
		return high;
	}
	public void setHigh(double high) {
		this.high = high;
	}
	public double getLow() {
		return low;
	}
	public void setLow(double low) {
		this.low = low;
	}
	public double getPrice() {
		return price;
	}
	public void setPrice(double price) {
		this.price = price;
	}
	public long getVolume() {
		return volume;
	}
	public void setVolume(long volume) {
		this.volume = volume;
	}
	  
 
	public Date getTrade_date() {
		return trade_date;
	}
	public void setTrade_date(Date trade_date) {
		this.trade_date = trade_date;
	}
	public StockStatus getStockStatus() {
		return stockStatus;
	}
	public void setStockStatus(StockStatus stockStatus) {
		this.tagName = stockStatus.name();
		this.tagDesc = stockStatus.getTagDesc();
		this.stockStatus = stockStatus;
	}
	@Override
	public String toString() {
	
		return ToStringBuilder.reflectionToString(this);
	}
	
}
